# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer:
pkgname=py3-factory-boy
_pkgname=factory_boy
pkgver=3.3.0
pkgrel=0
pkgdesc="A versatile test fixtures replacement based on thoughtbot's factory_girl for Ruby"
url="https://github.com/FactoryBoy/factory_boy"
arch="noarch"
license=MIT
depends="python3 py3-faker"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="
	py3-mock py3-django py3-sqlalchemy py3-pytest
"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/FactoryBoy/factory_boy/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-factory-boy" # Backwards compatibility
provides="py-factory-boy=$pkgver-r$pkgrel" # Backwards compatibility
options="!check" # temporary fix | some problems with test collection

prepare() {
	default_prepare
	# mongodb is not supported by Alpine Linux
	rm factory/mongoengine.py
	sed -i factory/__init__.py -e 's/from . import mongoengine//g'
	rm tests/test_mongoengine.py
	sed -i tests/__init__.py -e 's/from .test_mongoengine.*//g'
}

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 setup.py test
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
483e7454dbbafdf6ba2ec8924ccd648585c5ad5676da0af222a942beb3ebdbf4c372bb963c948d8a87a5359c1277b45b226239ff6109e11dbc1851ef5fd7275f  py3-factory-boy-3.3.0.tar.gz
"
